/**
 * 用户登录登出相关操作
 */
const USERINFO = "USERINFO";
const TOKEN = "TOKEN";

export const saveloginUser = (data: any) => {
  const { account, id, token, privilege } = data;
  sessionStorage.setItem(USERINFO, JSON.stringify({ account, id, privilege }));
  sessionStorage.setItem(TOKEN, token);
};

export const logoutUser = () => {
  sessionStorage.removeItem(USERINFO);
  sessionStorage.removeItem(TOKEN);
  localStorage.removeItem("language");
  localStorage.removeItem("dict");
  window.location.href = "/login";
};
